﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage1.master" AutoEventWireup="true" CodeFile="product.aspx.cs" Inherits="product" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style=" width:70%; margin:20px auto;">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="LinqDataSource1" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" Width="100%" 
        AllowPaging="True" PageSize="20" CellPadding="4" ForeColor="#333333" 
        GridLines="None" >
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="product_name" HeaderText="产品名" 
                ReadOnly="True" SortExpression="product_name" />
            <asp:BoundField DataField="manufacturer" HeaderText="厂家" 
                ReadOnly="True" SortExpression="manufacturer" />
            <asp:HyperLinkField DataNavigateUrlFields="shop_sign" 
                DataNavigateUrlFormatString="product1.aspx?id={0}" DataTextField="shop_sign" 
                HeaderText="牌号" />
            <asp:BoundField DataField="type" HeaderText="类型" ReadOnly="True" 
                SortExpression="type" />
            <asp:BoundField DataField="price" HeaderText="单价" ReadOnly="True" 
                SortExpression="price" />
            <asp:TemplateField HeaderText="库存" SortExpression="inventory">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("inventory") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("inventory") %>'></asp:Label>
                    kg
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="replace_time" HeaderText="更新时间" 
                ReadOnly="True" SortExpression="replace_time" />
        </Columns>
        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
        <SortedAscendingCellStyle BackColor="#FDF5AC" />
        <SortedAscendingHeaderStyle BackColor="#4D0000" />
        <SortedDescendingCellStyle BackColor="#FCF6C0" />
        <SortedDescendingHeaderStyle BackColor="#820000" />
    </asp:GridView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
        ContextTypeName="DataClassesDataContext" EntityTypeName="" 
        Select="new (product_name, manufacturer, shop_sign, type, price, replace_time, inventory)" 
        TableName="product">
    </asp:LinqDataSource>
    </div>
</asp:Content>

